{extend name="public/world"}
{block name="style"}
<link rel="stylesheet" href="/static/style/project.css?t={$Think.config.hello.version}" media="all">
<style>
.layui-rate {margin:0 !important;padding: 0 20px 0 0;}
.accordion-content {margin: 5px 0 8px;}
.layui-field-title {
    margin: 10px 0;
}
.listing li {
    list-style-type: square;
    margin-left: 10px;
    margin-bottom: 1px;
}
.layui-card-header a {
    color: #01AAED;
}
ul.no-bullet {
    margin: 10px 0 1px 10px !important;
}
@media screen and (max-width: 768px) {
    .layui-rate {
        margin: 0 !important;
        padding: 0 !important;
    }
    .listing li {
        list-style-type: square;
        margin-left: 2px;
        margin-bottom: 1px;
    }
}
</style>
{/block}
{block name="container"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">
            <a href="{:url('/projects.Index/show')}?id={$pro.id}&op=board">
                <i class="layui-icon layui-icon-export" style="font-size: 16px;position: initial;line-height: 42px;margin: 0 -5px;"></i>
                返回项目:{$pro.name}
            </a>
        </div>
        <div class="layui-card-body" style="padding: 0;">
            <div class="layui-form layui-tab layui-tab-card">
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <fieldset class="layui-elem-field layui-field-title">
                            <legend>任务:"{$task.title}"</legend>
                        </fieldset>
                        <div class="accordion-content">
                            <div class="listing" style="margin: 0;">
                                {$task.description}
                            </div>
                        </div>
                        <div class="accordion-content">
                            <div class="listing" style="padding: 0 0 5px;margin: 0;">
                                <div class="layui-row">
                                    <div class="layui-col-xs6 layui-col-sm6 layui-col-md3">
                                        <ul class="no-bullet">
                                            <li>创建者: {$account}</li>
                                            <li>指派给: {$owner_name}</li>
                                            <li>栏目位: {$task.column_name} #{$task.position}</li>
                                        </ul>
                                    </div>
                                    <div class="layui-col-xs6 layui-col-sm6 layui-col-md3">
                                        <ul class="no-bullet">
                                            <li>创建于：{$task['create_date']}</li>
                                            <li>开始于：{$task['start_date']}</li>
                                            <li>结束于：{$task['end_date']}</li>
                                        </ul>
                                    </div>
                                    <div class="layui-col-xs6 layui-col-sm6 layui-col-md3">
                                        <ul class="no-bullet">
                                            <li>计划工时: {$task.time_estimated}h</li>
                                            <li>实际工时: {$task.time_spent ? $task.time_spent.'h' : '--/--'}</li>
                                            <li>工时浮动: {$task.time_work}</li>
                                        </ul>
                                    </div>
                                    <div class="layui-col-xs6 layui-col-sm6 layui-col-md3">
                                        <ul class="no-bullet">
                                            <li>优先级别: {$task.deep_name}</li>
                                            <li>任务得分: {$task.rate_work}分</li>
                                            <li>作弊处罚: {$task.rate_punish}分</li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                                        <div id="rate_task"></div>
                                    </div>
                                    <div class="layui-col-xs12 layui-col-sm6 layui-col-md3">
                                        <ul class="no-bullet" style="margin-top: 0 !important;">
                                            <li></li>
                                        </ul>
                                    </div>
                                    <div class="layui-col-xs12 layui-col-sm6 layui-col-md3">
                                        <ul class="no-bullet" style="margin-top: 0 !important;">
                                            <li>评测得分: {$task.rate_audit}分</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <fieldset class="layui-elem-field layui-field-title">
                            <legend>工作日志</legend>
                        </fieldset>
                        <ul class="layui-timeline">
                            {volist name="jobs" id="job"}
                            <li class="layui-timeline-item">
                                <i class="layui-icon layui-timeline-axis">&#xe68d;</i>
                                <div class="layui-timeline-content layui-text">
                                    <div class="layui-timeline-title">
                                        {$job.user_name}
                                        <small class="activity-date">{$job.create_at}</small>
                                    </div>
                                    <ul>
                                        <li>{$job.job}</li>
                                    </ul>
                                </div>
                            </li>
                            {/volist}
                        </ul>
                        <fieldset class="layui-elem-field layui-field-title">
                            <legend>任务动态</legend>
                        </fieldset>
                        <ul class="layui-timeline">
                            {volist name="events" id="event"}
                            <li class="layui-timeline-item">
                                <i class="layui-icon layui-timeline-axis">&#xe68d;</i>
                                <div class="layui-timeline-content layui-text">
                                    <div class="layui-timeline-title">
{switch $event.event_name }
    {case create }{$event.user_name} 创建了任务 #{$event.data.zid} {/case}
    {case update }{$event.user_name} 修改了任务 #{$event.data.zid} {/case}
    {case move_swimlane }{$event.user_name} 将任务 #{$event.data.zid} 从 "{$event.data.swimlane_name}" 移动到泳道 "{$event.data.new_swimlane_name}" 下 {/case}
    {case move_column }{$event.user_name} 将任务 #{$event.data.zid} 从 "{$event.data.src_column_name}" 移动到栏目 "{$event.data.dst_column_name}" 下 {/case}
    {case move_position }{$event.user_name} 将任务 #{$event.data.zid} 从 "{$event.data.src_column_name}" 移动到栏目 "{$event.data.dst_column_name}" 的 #{$event.data.position} 位置 {/case}
{/switch}
                                        <small class="activity-date">{$event.create_at}</small>
                                    </div>
                                    <ul>
                                        <li>{$event.data.title}</li>
                                    </ul>
                                </div>
                            </li>
                            {/volist}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    layui.use(['form','rate'], function() {
        var $ = layui.jquery
            , rate = layui.rate
            , form = layui.form;
        var refreshDom = true;
        $("#App_tabsheader>li", parent.document).click(function(){
            if( typeof(refreshDom) != 'undefined' && refreshDom ) {
                window.location.reload();
            }
        });
        $('.tooltip').on('mouseover', function() {
            var that = this;
            layer.tips($(that).attr('lay-text'), that, {
                time : 0,
                tips : [2, '#5a5a5a']
            });
        }).on('mouseout', function() {
            layer.closeAll('tips');
        });
        rate.render({
            elem: '#rate_task'
            ,length: 10
            ,value: {$task.rate} //初始值
            ,text: true
            ,theme: '#{$task.rate < 5 ? '2F4056' : 'FF8000'}'
            ,readonly: true
            ,setText: function(value){ //自定义文本的回调
                var arrs = {
                    '1': '极差 扣40%'
                    ,'2': '非常差 扣30%'
                    ,'3': '很差 扣20%'
                    ,'4': '差 扣10%'
                    ,'5': '正常'
                    ,'6': '好 奖10%'
                    ,'7': '很好 奖20%'
                    ,'8': '非常好 奖30%'
                    ,'9': '特别好 奖40%'
                    ,'10': '极好 奖50%'
                };
                this.span.text(arrs[value] || ( value + "星"));
            }
        });
    });
</script>
{/block}